<?php
require_once './library/Zend/Db/Table/Abstract.php';

class logConfiguration extends Zend_Db_Table
{
    protected $_name;
    protected $_primary;
    protected $_db;
    protected $_registery;
    private $_select;

    protected function _setup()
    {
        $this->_name = 'logconfiguration';
        $this->_primary= 'IdLog';
        $this->_registry = Zend_Registry::getInstance();
        $this->_db = $this->_registry->get('adapter');
        parent::_setup();
    }

    public function getLog( $name )
    {
        $this->_select = $this->_db->select();
        $this->_select->from( 'logconfiguration' );
        $this->_select->where( 'LblConfiguration = ?', $name );
        $this->_select = $this->_db->query($this->_select);
        $result = $this->_select->fetchAll();
        if (isset($result[0]))
            return $result;
        return false;
    }

    public function listLog()
    {
        $this->_select = $this->_db->select();
        $this->_select->from('logconfiguration');
        $this->_select = $this->_db->query($this->_select);
        $result = $this->_select->fetchAll();
        if (isset($result[0]))
            return $result;
        return false;
    }

    public function newLog($pLblConfiguration, $pConfigurationXml)
    {
        $val = array('LblConfiguration' => $pLblConfiguration ,
                'ConfigurationXml' => $pConfigurationXml);
        $test = $this->_db->insert($this->_name, $val);
        return true;
    }
}

?>